Conversation
This reverts commit cd19403.
Member
|
Is that 3-50% of original code size or number of hints? |
Member
Author
|
Number of hints. So if function analysis gives 100 hints in the entire module, cross-function analysis adds 3-50 on top. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pass statically infers branch hint annotations, inspired by
LLVM's BranchProbabilityInfo:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Analysis/BranchProbabilityInfo.cpp
So far this sets low priority for throwing paths and even lower for
unreachable ones. It propagates such indications back to calling
blocks and even calling functions.
LLVM does a little more, it also has some minor hints for things like
a float being NaN (unlikely) and an integer/pointer being 0 (unlikely),
etc.
This pass has no benefit I can measure. My best guess is that we mostly
end up marking exit paths from functions (error handling, etc.), and VMs
can place those blocks and regalloc them efficiently without our hints.
The cross-function part can't be done by VMs, and adds a signficant
amount of hints (3-50% on real-world binaries) but even that does not
help any benchmark I have tried (Emscripten benchmark suite). Opening
this PR as draft to share that information, and maybe as a basis for future
work.